package org.yu.register.machine;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.world.phys.Vec3;

import javax.annotation.ParametersAreNonnullByDefault;

@ParametersAreNonnullByDefault
public class StoveRenderer implements BlockEntityRenderer<StoveBlockEntity> {
    private final BlockEntityRendererProvider.Context context;

    public StoveRenderer(BlockEntityRendererProvider.Context pContext){
        this.context=pContext;
    }
    @Override
    public void render(StoveBlockEntity pBlockEntity, float pPartialTick, PoseStack pPoseStack, MultiBufferSource pBufferSource, int pPackedLight, int pPackedOverlay) {
        var item=pBlockEntity.itemStackHandler.getStackInSlot(0);
            if(item.isEmpty()) return;
        pPoseStack.pushPose();
        pPoseStack.translate(0.5d,0.5d,0.5d);
        pPoseStack.scale(0.4f,0.4f,0.4f);
            var itemRender= Minecraft.getInstance().getItemRenderer();
            var model=itemRender.getModel(item,pBlockEntity.getLevel(),null,0);
            itemRender.render(item, ItemTransforms.TransformType.FIXED,false,pPoseStack,pBufferSource,15728880, OverlayTexture.NO_OVERLAY,model);
        pPoseStack.popPose();
    }

}
